package com.anbang.app.ui.guide

import android.os.Bundle
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentPagerAdapter

/**
 * @Description:
 * @Author: AnBang
 * @Date: 2019/1/11 19:07
 */
class GuideViewPagerAdapter(fragmentManager: FragmentManager, private val layoutIds: Array<Int>) : FragmentPagerAdapter(fragmentManager) {

    companion object {
        //布局ID
        const val KEY_LAYOUT_ID = "KEY_LAYOUT_ID"
        //位置
        const val KEY_POSITION = "KEY_POSITION"
    }

    override fun getItem(position: Int): Fragment {
        return GuideTranslateFragment().apply {
            arguments = Bundle().apply {
                putInt(KEY_LAYOUT_ID, layoutIds[position])
                putInt(KEY_POSITION, position)
            }
        }
    }

    override fun getCount(): Int {
        return 3
    }
}